package top.yokey.shopnc.model;

import top.yokey.base.base.BaseHttpClient;
import top.yokey.base.base.BaseHttpListener;
import top.yokey.shopnc.bean.GoodsBuyBean;

@SuppressWarnings("ALL")
public class MemberBuyModel {

    private final String ACT = "member_buy";
    private static volatile MemberBuyModel instance;

    public static MemberBuyModel get() {
        if (instance == null) {
            synchronized (MemberBuyModel.class) {
                if (instance == null) {
                    instance = new MemberBuyModel();
                }
            }
        }
        return instance;
    }

    public void pay(String paySn, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "pay")
                .add("pay_sn", paySn)
                .post(baseHttpListener);

    }

    public void checkPdPwd(String password, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "check_pd_pwd")
                .add("password", password)
                .post(baseHttpListener);

    }

    public void buySetp2(GoodsBuyBean goodsBuyBean, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "buy_step2")
                .add("ifcart", goodsBuyBean.getIfCart())
                .add("cart_id", goodsBuyBean.getCartId())
                .add("address_id", goodsBuyBean.getAddressId())
                .add("vat_hash", goodsBuyBean.getVatHash())
                .add("offpay_hash", goodsBuyBean.getOffPayHash())
                .add("offpay_hash_batch", goodsBuyBean.getOffPayHashBatch())
                .add("pay_name", goodsBuyBean.getPayName())
                .add("invoice_id", goodsBuyBean.getInvoiceId())
                .add("voucher", goodsBuyBean.getVoucher())
                .add("pd_pay", goodsBuyBean.getPdPay())
                .add("password", goodsBuyBean.getPassword())
                .add("fcode", goodsBuyBean.getFcode())
                .add("rcb_pay", goodsBuyBean.getRcbPay())
                .add("rpt", goodsBuyBean.getRpt())
                .add("pay_message", goodsBuyBean.getPayMessage())
                .add("isPoint", goodsBuyBean.getIsPoint())
                .post(baseHttpListener);

    }

    public void buySetp1(String cartId, String ifCart, String addressId, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "buy_step1")
                .add("cart_id", cartId)
                .add("ifcart", ifCart)
                .add("address_id", addressId)
                .post(baseHttpListener);

    }

}
